import React,{Component} from 'react';

import * as service   from './api';

class App extends Component{

  async componentDidMount() {

    //查询所有数据
    var res = await service.goods_list()

    //查询单个数据
    var res = await service.goods_info({ id: 2 })
    
    //分页查询数据
    var res = await service.goods_list2({ _page:2, _limit:2 })

    //排序查询数据
    var res = await service.goods_list3({ _sort:'price',_order:'desc' })

    //排序查询数据
    var res = await service.goods_list4({ name_like:'se' })

    //新增数据
    var res = await service.goods_add({ name:'iphone pro', price:10000 })

    //编辑数据
    var res = await service.goods_edit({ id:2, name:'iphone pro max', price:80000 })
    
    //删除数据
    var res = await service.goods_delete({ id:8 })

    

    console.log(res);
  }

  render(){
    return (
      <div className="app"></div>
    )
  }
}

export default App;
